package Touchy;

import java.net.URL;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

import project.ToolClient;

/**
 * The Touchy tools client
 * 
 * @author Sletten
 *
 */

public class TouchyClient extends ToolClient
{
	public TouchyClient()
	{
		mName = "Touchy!";
		mDescription = "Touchy! is a interactiv game that will help you train your skills in the touch typing technique";
		mCategory = 8;
	}
	public JPanel init()
	{
		mTool = new Touchy();
		if(mTool != null)
		{
			((Touchy)mTool).start();
		}
		return mTool.getPanel();	
	}
	public void run()
	{
		if(mTool != null)
		{
			((Touchy)mTool).start();
		}
	}
	
	public Icon getIcon() {
		URL imageUrl = getClass().getResource("/resources/touchy-icon.png");
		if (imageUrl != null) {
			return (Icon)new ImageIcon(imageUrl);
		} else {
			return super.getIcon();
		}
	}

	@SuppressWarnings("deprecation")
	public void stop()
	{
		mTool.stop();
		mTool = null;
	}

}
